from typing import List, Dict, Any, Optional
from pydantic import BaseModel

class ImageData(BaseModel):
    url: str
    jsonData: Dict[str, Any]

class Result(BaseModel):
    code: int
    message: str
    images: Optional[List[ImageData]] = None

    @classmethod
    def success(cls, images: List[ImageData], message: str = "处理成功") -> 'Result':
        return cls(code=200, message=message, images=images)

    @classmethod
    def error(cls, message: str = "处理失败", code: int = 500) -> 'Result':
        return cls(code=code, message=message)